home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <stdio.h>
- #include <time.h>
- #include <devices/timer.h>
-
- time_t StartTime;
- int YourTurn();
- void GetTheDate();
- int YourTurn()
- {
- static int DidI=0;
- int Data;
- time_t time2;
- char CMD[80];
- if(!DidI){ GetTheDate(); time(&StartTime);}
- DidI=1;
- getuserdata(7,&Data); time(&time2); if(Data<5){
- SM("",1);
- SM("Your time has expired for today. Your Party must rest.",1);
- return(0);
- }
-
- return(Data);
- }
-
- char *GetTheDate()
- {
- struct tm *tp;
- long t;
- int M,D,Y;
- char Date[9];
- char Day[4],Month[5],Year[3];
- char TheTime[27];
- time(&t);
- tp=localtime(&t);
- sprintf(TheTime,"%s",asctime(tp));
- sprintf(Day,"%.2s",&TheTime[8]);
- sprintf(Month,"%.3s",&TheTime[4]);
- sprintf(Year,"%.2s",&TheTime[22]);
- D=atoi(Day);
- Y=atoi(Year);
-
- if(!strncmp(Month,"Jan",3)) M=1;
- if(!strncmp(Month,"Feb",3)) M=2;
- if(!strncmp(Month,"Mar",3)) M=3;
- if(!strncmp(Month,"Apr",3)) M=4;
- if(!strncmp(Month,"May",3)) M=5;
- if(!strncmp(Month,"Jun",3)) M=6;
- if(!strncmp(Month,"Jul",3)) M=7;
- if(!strncmp(Month,"Aug",3)) M=8;
- if(!strncmp(Month,"Sep",3)) M=9;
- if(!strncmp(Month,"Oct",3)) M=10;
- if(!strncmp(Month,"Nov",3)) M=11;
- if(!strncmp(Month,"Dec",3)) M=12;
- sprintf(Date,"%02d-%02d-%02d",M,D,Y);
- return(Date);
- }
-